{
  "properties" : { },
  "id" : "copy1710913522393d19152",
  "script" : null,
  "groupId" : "9d05c436918542538232e38042f2a20a",
  "name" : "获取-数据子节点",
  "createTime" : 1714063373008,
  "updateTime" : 1710916900240,
  "lock" : null,
  "createBy" : "管理员",
  "updateBy" : "管理员",
  "path" : "getDataNode",
  "description" : null,
  "returnType" : null,
  "mappingPath" : null,
  "parameters" : [ {
    "name" : "baseDatas",
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : "java.util.Collection",
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "nodeData",
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "idKey",
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : "java.lang.String",
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "pIdKey",
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : "java.lang.String",
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ]
}
================================
import com.alibaba.fastjson.JSONObject;
import '@/system/getDataNode' as getDataNode;

for (data in baseDatas) {
  var tData = JSONObject.toJSON(data);
  // 如果有匹配的
  if(nodeData[idKey] == tData[pIdKey]){
    // 看上级有没有该参数，没有就加一个空数组
    if(! nodeData["children"]){
      nodeData["children"] = [];
    } 
    getDataNode(baseDatas, tData, idKey, pIdKey);

    // 把数据给上级
    nodeData["children"].add(tData);
  }

}
